package com.jaws.core.common.excel.function;

import java.lang.reflect.Method;

import lombok.extern.slf4j.Slf4j;

import com.jaws.core.common.excel.context.JawsPoiExporterContext;
import com.jaws.core.common.log.Log;

/**
 * 函数注册器
 * @author maojian
 * @date 2018-05-21 16:40:31
 * @since v1.0.0
 */
@Slf4j
public class FunctionRegister {
	
	public static void registerInternalFunction(){
		Method[] methods = InternalUtils.class.getDeclaredMethods();
		log.info(Log.op("FunctionRegister.registerInternalFunction").msg("PoiEl注册的内部函数begin").toString());
		for(Method m : methods){
			JawsExcelFuncAnno func = m.getAnnotation(JawsExcelFuncAnno.class);
			log.info(Log.op("FunctionRegister.registerInternalFunction").msg("注册函数").kv("funName", func.value()).toString());
			JawsPoiExporterContext.EVAL_CONTEXT.registerFunction(func.value(), m);
		}
		log.info(Log.op("FunctionRegister.registerInternalFunction").msg("PoiEl注册的内部函数end").toString());
	}
}
